package cn.wolfcode.shop.cloud.service.impl;

import cn.wolfcode.shop.cloud.domain.Goods;
import cn.wolfcode.shop.cloud.mapper.GoodsMapper;
import cn.wolfcode.shop.cloud.service.IGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;

@Service
public class GoodsServiceImpl implements IGoodsService {
    @Autowired
    private GoodsMapper goodsMapper;


    @Override
    public Goods get(Long id) {
        Goods goods = goodsMapper.get(id);
        return goods;
    }

    @Override
    public List<Goods> queryGoods(Set<Long> goodsId) {
        if (goodsId != null && goodsId.size()>0){
            ArrayList list = new ArrayList(goodsId);
            List<Goods> goods = goodsMapper.queryGoods(list);
            return goods;
        }
       return Collections.emptyList();
    }
}
